﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using AspNetCs.Common;
using AspNetCs.Bll;
using AspNetCs.SQLServerDAL;

public partial class Users_Send : BasePage
{
    protected int ReciveMessageId = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        CheckUserExit("Login.Aspx", "请您登录", true);
        if (!IsPostBack)
        {
            ReciveMessageId = StringHelper.isNumber_int(Request["id"]);
            ViewState["id"] = ReciveMessageId;
            DataBindRepeater();
        }
        else
        {
            if (ViewState["id"] != null)
            {
                ReciveMessageId = StringHelper.isNumber_int(ViewState["id"].ToString());
            }
        }
    }

    public void DataBindRepeater()
    {
        DataTable dataTable = new DataTable();
        string cmdText = "select *,CreateName=(select userName from users where userid=ReciverId) from Message where id={0}";
        cmdText = string.Format(cmdText, ReciveMessageId);
        dataTable = ExcuteSqlTextBLL.GetDataTable(cmdText);
        rptMsgs.DataSource = dataTable;
        rptMsgs.DataBind();
    }
}
